<?php

namespace app\mini\controller\v1\client;

use app\common\library\MemberVo;
use app\common\logic\BillTitleLogic;
use app\mini\controller\Common;
use think\Request;
use think\response\Json;

class BillTitle extends Common
{

    public $BillTitleLogic;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->BillTitleLogic = new BillTitleLogic();
    }

    /**
     * 发票抬头列表
     * @return Json
     */
    public function index(): Json
    {
        $res = $this->exception(function () {
            $params['member_id'] = MemberVo::instance()->getMemberId();
            return $this->BillTitleLogic->index($params);
        });
        return $this->response($res);
    }

    /**
     * 发票抬头信息
     * @return Json
     */
    public function info(): Json
    {
        $res = $this->exception(function () {
            $params = request()->param();
            $params['member_id'] = MemberVo::instance()->getMemberId();
            return $this->BillTitleLogic->info($params);
        });
        return $this->response($res);
    }


    /**
     * 发票抬头添加
     * @return Json
     */
    public function edit(): Json
    {
        $res = $this->exception(function () {
            $params = request()->param();
            $params['member_id'] = MemberVo::instance()->getMemberId();
            return $this->BillTitleLogic->edit($params);
        });
        return $this->response($res);
    }

    /**
     * 发票抬头删除
     * @return Json
     */
    public function del(): Json
    {
        $res = $this->exception(function () {
            $params = request()->param();
            $params['member_id'] = MemberVo::instance()->getMemberId();
            return $this->BillTitleLogic->del($params);
        });
        return $this->response($res);
    }
}
